package com.zlsy.springbootdemo.chainofresponsibility.mtdemo2;

import com.zlsy.springbootdemo.chainofresponsibility.mtdemo2.context.RuleContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhouliang
 * @date 2021/1/23 15:37
 */
@Component
public class DefaultRuleEngine {

  @Resource(name = "userPortraitRules")
  private List<Rule> userPortraitRules;

  @SuppressWarnings("unchecked")
  public void invokeAll(RuleContext ruleContext) {
    System.out.println(userPortraitRules.size());
    for (Rule rule : userPortraitRules) {
      rule.evaluate(ruleContext);
    }
  }
}
